class Configuration extends Object
Modifier and Type | Field and Description |
---|---|
private HashMap<String,String> |
_chars
Mapping between HTML named entities (ie.
|
private HashMap<Integer,String> |
_charsNum
Mapping between HTML decimal decimal entities and LaTeX commands.
|
private String |
_commandsPrefix
Prefix of new LaTeX commands generated by the program.
|
private HashMap<String,ElementConfigItem> |
_elements
Mapping between HTML elements and LaTeX commands.
|
private LinksConversion |
_linksConversion
The way of converting hyperlinks.
|
private boolean |
_makeCmdsFromCSS
Make new LaTeX commands from the CSS styles.
|
private HashMap<String,CSSStyle> |
_styles
CSS styles used with converted file.
|
private HashMap<String,CSSPropertyConfigItem> |
_stylesConf
Mappings between CSS properties and LaTeX commands.
|
Constructor and Description |
---|
Configuration(String configFilePath)
Loads all the configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addStyle(String name,
CSSStyle style)
Adds user style to the configuration.
|
CSSStyle |
findStyle(String elementName)
Finds style for element.
|
CSSStyle |
findStyleClass(String className,
String elementName)
Finds style for element with specified
class attribute |
CSSStyle |
findStyleId(String elementId,
String elementName)
Finds style for element with specified
id attribute |
String |
getChar(Integer charNum)
Returns LaTeX command for the specified entity.
|
String |
getChar(String charName)
Returns LaTeX command for the specified entity.
|
String |
getCmdStyleName(String styleName)
style name without special chars
|
ElementConfigItem |
getElement(String name)
Returns element's configuration.
|
LinksConversion |
getLinksConversionType()
Returns the way of converting hyperlinks.
|
boolean |
getMakeCmdsFromCSS()
Returns true when new LaTeX commands are to be made from CSS styles.
|
CSSPropertyConfigItem |
getPropertyConf(String property)
Returns CSS property configuration.
|
CSSStyle |
getStyle(String styleName)
Returns style defined in the user stylesheet.
|
private void |
loadCharsConfiguration(Element root)
Loads mapping between HTML named entities (ie.
|
private void |
loadElementsConfiguration(Element root)
Loads mapping between HTML elements and LaTeX commands.
|
private void |
loadLinksConfiguration(Element root)
Loads
options for converting hyperlinks. |
private void |
loadStylesConfiguration(Element root)
Loads mappings between CSS properties and LaTeX commands.
|
private void |
loadStyleSheet(File f)
Loads user style sheet.
|
String |
makeCmdsFromCSS()
Makes new LaTeX commands from the CSS styles.
|
private String |
replaceSpecialStrings(String str)
Replaces special @-strings with appropriate strings
(ie.
|
private HashMap<String,ElementConfigItem> _elements
key : <elementName>
private HashMap<String,String> _chars
key : <entityName>
value : LaTeX command
private HashMap<Integer,String> _charsNum
key : <entityDecimalNum>
value : LaTeX command
private HashMap<String,CSSStyle> _styles
key : <styleName>
private HashMap<String,CSSPropertyConfigItem> _stylesConf
key : <propertyName>-<propertyValue>
private LinksConversion _linksConversion
private boolean _makeCmdsFromCSS
private String _commandsPrefix
public Configuration(String configFilePath) throws FatalErrorException
configFilePath
- the absolute path of the XML config fileFatalErrorException
- when error during processing configuration occursprivate void loadElementsConfiguration(Element root)
root
- root element of the XML configuration fileprivate void loadCharsConfiguration(Element root)
root
- root element of the XML configuration fileprivate void loadLinksConfiguration(Element root)
options
for converting hyperlinks.root
- root element of the XML configuration fileprivate void loadStylesConfiguration(Element root)
root
- root element of the XML configuration fileprivate void loadStyleSheet(File f)
f
- CSS fileprivate String replaceSpecialStrings(String str)
str
- input stringpublic ElementConfigItem getElement(String name) throws NoItemException
name
- element's nameNoItemException
- when element isn't found in the configurationpublic LinksConversion getLinksConversionType()
public String getChar(String charName) throws NoItemException
charName
- entity nameNoItemException
- when entity isn't found in the configurationpublic String getChar(Integer charNum) throws NoItemException
charNum
- entity numberNoItemException
- when entity isn't found in the configurationpublic CSSStyle getStyle(String styleName)
styleName
- style namepublic CSSStyle findStyleClass(String className, String elementName)
class
attributeclassName
- element's class
attributeelementName
- element namepublic CSSStyle findStyleId(String elementId, String elementName)
id
attributeelementId
- element's id
attributeelementName
- element namepublic CSSStyle findStyle(String elementName)
elementName
- element namepublic CSSPropertyConfigItem getPropertyConf(String property) throws NoItemException
property
- property and value name (<propertyName>-<valueName>)NoItemException
- when property isn't found in the configurationpublic void addStyle(String name, CSSStyle style)
name
- style namestyle
- CSS stylepublic String makeCmdsFromCSS()
public String getCmdStyleName(String styleName)
styleName
- style namepublic boolean getMakeCmdsFromCSS()